<template>
  <div id="app">
    <router-view></router-view>
  </div>
</template>
<script>

export default {
  name: 'app',

methods:{
  handleLogin(){

    this.$http.post('login',this.loginForm).then(res=>{

      if (res.data.meta.status==200){
        Message.success(res.data.meta.msg)
        let token = res.data.data.token
        console.log(res.data.data.username)
        this.$store.commit('saveUsername',res.data.data.username)
        window.sessionStorage.setItem('token',token)
        this.$router.push('/home')

      }
      if (res.data.meta.status!=200){
        Message.error(res.data.meta.msg)
      }




    })

    // this.$refs.loginFormRef.validate(async valid=>{
    //     console.log(valid)
    //
    //     console.log(this.loginForm)
    // })
  },
  resetLoginForm(){
    // console.log(this)
    this.$refs.loginFormRef.resetFields()
    this.loginForm.username=this.loginForm.password=''
  },

}

}
</script>

<style>

</style>
